﻿using CatUtils.Utils.Currency.IoUtils;
using CatUtils.Utils.Currency.TextUtils;
using CatUtils.Utils.Helper;
using CatUtils.Utils.SpecialUtils.View;
using System;

namespace RabbitDownload.WebSite.Pixiv
{
    /// <summary>
    ///  站数据处理方法
    /// </summary>
    internal class PixivStaticValue
    {
        public static string PixivCookies = StaticValue.BinPath + "PixivCookies.txt";

        public static string GetPixivCookies()
        {
            string Cookies = FileHelper.ReadAllText(PixivCookies);

            if (Cookies == "")
            {
                MessageHelper.Alert("Pixiv需要重新写入Cookies");

                FloderHelper.OpenFloder(PixivCookies);

                if (MessageHelper.DialogResultAlert("我已经重新设置PixivCookies"))
                    GetPixivCookies();
                else { MessageHelper.Alert("没有设置COOKIES，程序退出 请稍后自行重启"); Environment.Exit(0); }
            }
            return Cookies;
        }

        /*
         const titles = {
  'day': 'pixiv 日排行',
  'week': 'pixiv 周排行',
  'month': 'pixiv 月排行',
  'day_male': 'pixiv 受男性欢迎排行',
  'day_female': 'pixiv 受女性欢迎排行',
  'week_original': 'pixiv 原创作品排行',
  'week_rookie': 'pixiv 新人排行',
  'day_r18': 'pixiv R-18 日排行',
  'day_male_r18': 'pixiv R-18 受男性欢迎排行',
  'day_female_r18': 'pixiv R-18 受女性欢迎排行',
  'week_r18': 'pixiv R-18 周排行',
  'week_r18g': 'pixiv R-18G 排行'
};

const links = {
  'day': 'https://www.pixiv.net/ranking.php?mode=daily',
  'week': 'https://www.pixiv.net/ranking.php?mode=weekly',
  'month': 'https://www.pixiv.net/ranking.php?mode=monthly',
  'day_male': 'https://www.pixiv.net/ranking.php?mode=male',
  'day_female': 'https://www.pixiv.net/ranking.php?mode=female',
  'week_original': 'https://www.pixiv.net/ranking.php?mode=original',
  'week_rookie': 'https://www.pixiv.net/ranking.php?mode=rookie',
  'day_r18': 'https://www.pixiv.net/ranking.php?mode=daily_r18',
  'day_male_r18': 'https://www.pixiv.net/ranking.php?mode=male_r18',
  'day_female_r18': 'https://www.pixiv.net/ranking.php?mode=female_r18',
  'week_r18': 'https://www.pixiv.net/ranking.php?mode=weekly_r18',
  'week_r18g': 'https://www.pixiv.net/ranking.php?mode=r18g'
};

             */

        /// <summary>
        ///  .是否跳过漫画
        /// </summary>
        public static bool BlockComic { get; set; } = true;

        /// <summary>
        /// 画师api
        /// </summary>
        public static string ArtApi1 { get; set; } = "https://www.pixiv.net/touch/ajax_api/ajax_api.php?mode=user_illust&id={0}&p={1}&res=&tag=&type=";

        /// <summary>
        /// 每日男性
        /// </summary>
        public static string DayMaleAPI { get; set; } = "https://www.pixiv.net/ranking.php?mode=male&date={0}&p={1}&format=json";

        /// <summary>
        /// 每日女性
        /// </summary>
        public static string DayFemaleAPI { get; set; } = "https://www.pixiv.net/ranking.php?mode=female&date={0}&p={1}&format=json";

        /// <summary>
        /// 每周
        /// </summary>
        public static string DayWeeklyAPI { get; set; } = "https://www.pixiv.net/ranking.php?mode=weekly&date={0}&p={1}&format=json";

        /// <summary>
        /// 每月
        /// </summary>
        public static string DayMonthlyAPI { get; set; } = "https://www.pixiv.net/ranking.php?mode=monthly&date={0}&p={1}&format=json";

        public static string DayR18 { get; set; } = "https://www.pixiv.net/ranking.php?mode=daily_r18&date={0}&p={1}&format=json";

        /// <summary>
        /// 每日
        /// </summary>
        public static string DayAPI { get; set; } = "https://www.pixiv.net/ranking.php?mode=daily&date={0}&p={1}&format=json";

        /// <summary>
        /// 搜索API
        /// </summary>
        public static string SearchTagApi { get; set; } = "https://www.pixiv.net/touch/ajax_api/search_api.php?endpoint=search&mode=search_illust&word={0}&order=&p={1}&type=&scd=&ecd=&circle_list=0&s_mode=s_tag&blt=&bgt=&adult_mode=";

        /// <summary>
        /// 支持时间的搜索API
        /// </summary>
        public static string SearchTagApiForTime { get; set; } = "https://www.pixiv.net/touch/ajax_api/search_api.php?endpoint=search&mode=search_illust&word={0}&order=&p={1}&type=&scd={2}&ecd={3}&circle_list=0&s_mode=s_tag&blt=&bgt=&adult_mode=";

        /// <summary>
        /// 启用屏蔽模式
        /// </summary>
        public static bool ExcludeOpenFlag { get; set; } = false;
    }
}